package org.momo.rpc.circuitbreaker;

import org.momo.rpc.circuitbreaker.impl.CircuitBreaker;
import org.momo.rpc.provider.model.ProviderRegistryInfo;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;


public class CircuitBreakerProvider {
    private static final Map<String, CircuitBreaker> circuitBreakerMap = new ConcurrentHashMap<>();

    public static CircuitBreaker getCircuitBreaker(String serviceAddress) {
        if(!circuitBreakerMap.containsKey(serviceAddress)) {
            circuitBreakerMap.put(serviceAddress, new CircuitBreaker());
        }
        return circuitBreakerMap.get(serviceAddress);
    }
}
